cssmatcher: Actually match names for widget paths
authorBenjamin Otte <otte@redhat.com>
Tue, 27 Oct 2015 02:11:21 +0000 (03:11 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 27 Oct 2015 02:13:42 +0000 (03:13 +0100)
The type is always 0 when we use names. So this would always return
FALSE. Oops.

gtk/gtkcssmatcher.c

index 71a4cba0a0e591c859ddf9ff26128af332b01853..8dd26d52fe2566d288fd602cb677179b8cab03a9 100644 (file)
@@ -79,16 +79,17 @@ gtk_css_matcher_widget_path_has_name (const GtkCssMatcher     *matcher,
 {
   const GtkWidgetPath *siblings;
 
-  if (type == 0)
-    return FALSE;
-
   siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
   if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
     {
       const char *path_name = gtk_widget_path_iter_get_object_name (siblings, matcher->path.sibling_index);
 
       if (path_name == NULL)
-        return g_type_is_a (gtk_widget_path_iter_get_object_type (siblings, matcher->path.sibling_index), type);
+        {
+          if (type == 0)
+            return FALSE;
+          return g_type_is_a (gtk_widget_path_iter_get_object_type (siblings, matcher->path.sibling_index), type);
+        }
 
       return path_name == name;
     }
@@ -97,7 +98,11 @@ gtk_css_matcher_widget_path_has_name (const GtkCssMatcher     *matcher,
       const char *path_name = gtk_widget_path_iter_get_object_name (matcher->path.path, matcher->path.index);
 
       if (path_name == NULL)
-        return g_type_is_a (gtk_widget_path_iter_get_object_type (matcher->path.path, matcher->path.index), type);
+        {
+          if (type == 0)
+            return FALSE;
+          return g_type_is_a (gtk_widget_path_iter_get_object_type (matcher->path.path, matcher->path.index), type);
+        }
 
       return path_name == name;
     }